<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div class='app-container'>
    <el-form ref="form" :model="s_step" :rules="rules" label-width="100px" id="mvcfm">
      <el-button @click="gotoPage('/psi/supplychainmana/InventorySettingsSupply?'+vueparams+'')" type='primary' size="mini"><i class='fa fa-reply'></i>返回</el-button>
      <el-button @click="processPersonSubmit('')" type='success' size="mini"><i class='fa fa-check'></i>保存</el-button>
      <div class="form-unit">
        <span class="mvc-title-left"> 盘存流程 </span>
      </div>
      <el-table :data="s_step">
        <el-table-column label="步骤" prop="step_name">
          {{scope.row.step_name}}
        </el-table-column>
        <el-table-column label="人员" prop="step_userid">
          <template slot-scope="scope">
            {{scope.row.step_userid}}
            <el-button @click="popCompanyPersonSupply('step_userid','step_userid')" type="success" size="mini"><i class="fa fa-edit"></i>选择</el-button>
          </template>
        </el-table-column>
      </el-table>
    </el-form>
    <el-dialog :visible.sync="CompanyPersonSupplyVisible" append-to-body>
      <CompanyPersonSupply v-if="CompanyPersonSupplyVisible" ref="CompanyPersonSupply" :popparams="popparams"> </CompanyPersonSupply>
    </el-dialog>
  </div>
</template>
<script>
  import request from '@/utils/request'
  import CompanyPersonSupply from "@/views/psi/supplychainmana/CompanyPersonSupply";
  export default {
    name: 'ProcessPerson',
    components: {
      CompanyPersonSupply,
    },
    props: ['popparams'],
    data() {
      return {
        CompanyPersonSupplyVisible: false,
        CompanyPersonSupplyValue: null,
        CompanyPersonSupplyDesc: null,
        vueparams: this.getVUEParams(""),
        s_step: [],
        loading: false,
        rules: {}
      }
    },
    created() {
      this.getData();
    },
    updated() {},
    mounted() {},
    methods: {
      getData() {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/psi/supplychainmana/WarehouseAction/processPerson?' + this.vueparams,
        }).then(data => {
          for (var k in data) {
            if (Array.isArray(data[k])) {
              this[k] = data[k];
            } else {
              $.extend(this[k], data[k]);
            }
          }
        })
      },
      processPersonSubmit(_params) {
        request({
          method: 'post',
          url: '/xcapi/VUEAction/psi/supplychainmana/WarehouseAction/processPersonSubmit?' + _params + this.vueparams,
          data: this.postData()
        }).then(data => {
          this.gotoPage("/psi/supplychainmana/InventorySettingsSupply/inventorySettingsSupply?" + this.vueparams, data);
          this.msgSuccess(data.msg);
        })
      },
      popCompanyPersonSupply(desc, value) {
        this.CompanyPersonSupplyVisible = true;
        this.CompanyPersonSupplyDesc = desc;
        this.CompanyPersonSupplyValue = value;
      },
      closeCompanyPersonSupply(value, desc) {
        this.CompanyPersonSupplyVisible = false;
        this.$set(this.s_step, this.CompanyPersonSupplyDesc, desc);
        this.$set(this.s_step, this.CompanyPersonSupplyValue, value);
      },
    },
  }
</script>
